package com.jl.cloud.commom.base;

import com.alibaba.fastjson.JSON;
import com.jl.cloud.commom.exception.SystemExceptionEnum;
import lombok.Data;

import java.io.Serializable;

/**
 * 返回对象基类
 * @author liang.jun
 */
@Data
public class BaseResponse<T> implements Serializable {

	private static final long serialVersionUID = -5437860235020009457L;

	/** 返回码 */
	private String responseCode = "100000";

	/** 返回描述 */
	private String message = "运行正确";

	/** 返回结果对象 */
	private T result;
	
	public BaseResponse() {

	}


	public BaseResponse(String responseCode,String message ) {
			this.responseCode = responseCode;
			this.message = message;
	}



	public BaseResponse(SystemExceptionEnum systemExceptionEnum) {
			this.responseCode = systemExceptionEnum.getCode();
			this.message = systemExceptionEnum.getMessage();
	}
	
	public BaseResponse(T result) {
		this.result = result;
	}
	@Override
	public String toString() {
		return JSON.toJSONString(this);
	}

}
